unit U_GiderYeriTanim;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView,
  cxGridTableView, cxGridDBTableView, ADODB, Menus, ActnList, cxGridLevel,
  cxClasses, cxControls, cxGridCustomView, cxGrid, StdCtrls, Buttons,
  ExtCtrls, cxCheckBox, siComp;

type
  TfmGiderYeriTanim = class(TForm)
    Panel2: TPanel;
    pnl_Alt: TPanel;
    bKapat: TBitBtn;
    cxgrid1: TcxGrid;
    cxgrid1DBTableView1: TcxGridDBTableView;
    cxgrid1Level1: TcxGridLevel;
    Panel3: TPanel;
    cxGrid3: TcxGrid;
    cxGridDBTableView2: TcxGridDBTableView;
    cxGridLevel2: TcxGridLevel;
    DSAnaGider: TDataSource;
    ActListe: TActionList;
    acYeni: TAction;
    acDuzelt: TAction;
    acSil: TAction;
    acKapat: TAction;
    adoTemp: TADOQuery;
    adoSil: TADOQuery;
    PM1: TPopupMenu;
    PM1_Ekle: TMenuItem;
    PM1_Sil: TMenuItem;
    PM2: TPopupMenu;
    PM2_Ekle: TMenuItem;
    PM2_Sil: TMenuItem;
    adoAnaGider: TADOTable;
    cx: TADOQuery;
    DSAltGider: TDataSource;
    adoAltGider: TADOTable;
    cxgrid1DBTableView1KARTKODU: TcxGridDBColumn;
    cxgrid1DBTableView1ACIKLAMA: TcxGridDBColumn;
    cxgrid1DBTableView1OZELKOD1: TcxGridDBColumn;
    cxgrid1DBTableView1OZELKOD2: TcxGridDBColumn;
    cxgrid1DBTableView1OZELKOD3: TcxGridDBColumn;
    cxgrid1DBTableView1YETKIKOD: TcxGridDBColumn;
    cxgrid1DBTableView1AKTIF: TcxGridDBColumn;
    cxGridDBTableView2KARTKODU: TcxGridDBColumn;
    cxGridDBTableView2ACIKLAMA: TcxGridDBColumn;
    cxGridDBTableView2OZELKOD1: TcxGridDBColumn;
    cxGridDBTableView2OZELKOD3: TcxGridDBColumn;
    cxGridDBTableView2YETKIKOD: TcxGridDBColumn;
    cxGridDBTableView2AKTIF: TcxGridDBColumn;
    cxGridDBTableView2OZELKOD2: TcxGridDBColumn;
    cxGrid2: TcxGrid;
    cxGridDBTableView1: TcxGridDBTableView;
    cxGridLevel1: TcxGridLevel;
    Panel1: TPanel;
    adoAyrinti: TADOTable;
    DSAyrinti: TDataSource;
    cxGridDBTableView1KARTKODU: TcxGridDBColumn;
    cxGridDBTableView1ACIKLAMA: TcxGridDBColumn;
    cxGridDBTableView1OZELKOD1: TcxGridDBColumn;
    cxGridDBTableView1OZELKOD2: TcxGridDBColumn;
    cxGridDBTableView1OZELKOD3: TcxGridDBColumn;
    cxGridDBTableView1YETKIKOD: TcxGridDBColumn;
    cxGridDBTableView1AKTIF: TcxGridDBColumn;
    PM3: TPopupMenu;
    MenuItem1: TMenuItem;
    MenuItem2: TMenuItem;
    procedure bKapatClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormCreate(Sender: TObject);
    procedure PM2_EkleClick(Sender: TObject);
    procedure PM2_SilClick(Sender: TObject);
    procedure PM1_EkleClick(Sender: TObject);
    procedure MenuItem1Click(Sender: TObject);
    procedure MenuItem2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmGiderYeriTanim: TfmGiderYeriTanim;

implementation
           uses U_DBFunctions_, ana1;
{$R *.dfm}

procedure TfmGiderYeriTanim.bKapatClick(Sender: TObject);
begin
   close;
end;

procedure TfmGiderYeriTanim.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action:=Cafree;
  fmGiderYeriTanim:= Nil;
end;

procedure TfmGiderYeriTanim.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key=27 then close;
end;

procedure TfmGiderYeriTanim.FormCreate(Sender: TObject);
begin
  adoAnaGider.Open;
  adoAltGider.open;
end;

procedure TfmGiderYeriTanim.PM2_EkleClick(Sender: TObject);
begin

  if KayitVarYok(adoAnaGider) =True then
     adoAltGider.insert ;

end;

procedure TfmGiderYeriTanim.PM2_SilClick(Sender: TObject);
begin
  adoAltGider.Delete;  
end;

procedure TfmGiderYeriTanim.PM1_EkleClick(Sender: TObject);
begin
   adoAnaGider.insert;
end;

procedure TfmGiderYeriTanim.MenuItem1Click(Sender: TObject);
begin
  if KayitVarYok(adoAltGider) =True then
     adoAyrinti.insert ;
end;

procedure TfmGiderYeriTanim.MenuItem2Click(Sender: TObject);
begin
   adoAyrinti.Delete; 
end;

end.